﻿
Imports System
Imports System.Web
Imports System.Web.SessionState
Imports SimpleMVVMFileUpload

' Copyright (c) 2010
' by OpenLight Group
' http://openlightgroup.net/
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
'
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.



Public Class FileUpload
    Implements IHttpHandler
    Public Sub New()
    End Sub

    Private ctx As HttpContext

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
        ctx = context
        Dim fileUpload As FileUploadProcess = New FileUploadProcess
        AddHandler fileUpload.FileUploadCompleted, New FileUploadCompletedEvent(AddressOf fileUpload_FileUploadCompleted)
        fileUpload.ProcessRequest(context)
    End Sub

    Private Sub fileUpload_FileUploadCompleted(ByVal sender As Object, ByVal args As FileUploadCompletedEventArgs)
        Dim id As String = ctx.Request.QueryString("id")
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
        Get
            Return True
        End Get
    End Property
End Class

